/**
 * 常量配置, 子应用也共享这个文件
 */

/**
 * 读取静态配置
 * @private
 */
const __MY_CONFIG__ = window.__MY_CONFIG__ || {}

// 根据开发环境或生产环境获取不同的地址
function getConfig(name, defaultValue) {
  const devConfig = __MY_CONFIG__.develop || {}
  const proConfig = __MY_CONFIG__.production || {}
  if (process.env.NODE_ENV !== 'production') {
    // 如果没有分开发环境或生产环境，那就看看有没有放在外层的公共设置
    const val = devConfig[name] === undefined ? __MY_CONFIG__[name] : devConfig[name]
    if (val === undefined && defaultValue !== undefined) {
      return defaultValue
    } else {
      return val
    }
  } else {
    const val = proConfig[name] === undefined ? __MY_CONFIG__[name] : proConfig[name]
    if (val === undefined && defaultValue !== undefined) {
      return defaultValue
    } else {
      return val
    }
  }
}
/**
 * 接口服务器
 * @type {*|string}
 */
export const API_HOST = getConfig('API_HOST')

export const NGINX_HOST = getConfig('NGINX_HOST')

export const SYSTEM_TITLE = getConfig('SYSTEM_TITLE')

export const SYSTEM_MS = getConfig('SYSTEM_MS')

export const whitList = getConfig('whitList')

export const LOGIN_TO = getConfig('LOGIN_TO')

export const DOWN_RUL = getConfig('DOWN_RUL')

export const JRRDRC = getConfig('JRRDRC')

export const WEATHER = getConfig('WEATHER')

export const RCZRS = getConfig('RCZRS')

export const AMapKey = getConfig('AMapKey')

export const publicPath = getConfig('publicPath')

export const h5Path = getConfig('h5Path')

